--[[
  已确认参数函数
  gui.opacity(float) -gui.drawxxx的透明度,1为不透明,0就看不到了
  gui.drawtext(number,number,string,[color], [color])  无效
  gui.text(number,number,string,[color], [color]) 无效
  gui.drawline(int,int,int,int)(无颜色) 画线
  gui.drawbox(int,int,int,int)(无颜色) 画矩形
  gui.drawrect(int,int,int,int)(无颜色) 画矩形
  memory.writebyte(地址, byte) 写入内存
  memory.readbyte(地址) 读入内存
  emu.message(string) 屏幕右下显示字符
  emu.registerbefore(func) 每一帧后的函数,重要,emu.registerafter画不出图
]]

function fa()
  memory.writebyte(0x60103C3, 5) --1945ii bomb
  gui.drawtext(200,200,"aaa",0xFF000000,0xFFff000000)
  gui.drawbox(50,50,100,100,0xFF000000,0xFFff000000)
  gui.drawline(70,70,125,125,0xFF000000,0xFFff000000)
  gui.text(10,10,"tttt", 0xff0000, 0xff0000)
end

function fb()
  memory.writebyte(0x60103C3, 4) --1945ii bomb
  gui.drawtext(0.3,0.3,"AAAAAAAAAA",0xFF000000,0xFFff000000)
  gui.drawbox(10,10,100,100)
  gui.drawline(200,100,195,195)
  gui.text(10,10,"aaa", 0xff0000, 0xff0000)
  gui.drawrect(80,80,195,190)
end

function fe()
  memory.writebyte(0x60103C3, 3) --1945ii bomb
  gui.drawtext(100,100,"aaa",0xFF000000,0xFFff000000)
end

function myFunction()
  gui.drawtext(0.1,0.1,"aaa",0xFF000000,0xFFff000000)
  gui.drawbox(0,0,100,100,0xFF000000,0xFFff000000)
  print(memory.readbyte(0x6010414)) --1945ii charge
  emu.message("emuMMMMessage", "gggg")
  --emu.registerafter(fa)
  emu.registerbefore(fb)
  --emu.registerexit(fe)
  --box1 = gui.box(0,1,2)
  gui.opacity(0.3,"aaa") --1数字参数确认
  box2 = gui.box(0.0,0.0,0.5,0.5,"tt","gg") --4数字参数确认
  gui.drawbox(0.0,0.0,0.5,0.5,"tt","gg")
  gui.drawbox(0,0,100,100) --4数字参数确认
  gui.drawtext(0,0,"aaa", 0xff0000, 0xff0000) --2数字+1字符串参数确认
  gui.drawrect(1,2,3,4,"aaa")
  gui.drawline(0,0,0.5,0.5,"aa",0xff0000)
  gui.text(10,10,"aaa", 0xff0000, 0xff0000)
  --memory.writebyte(0x60103C3, 5) --bomb
  emu.print("emu.print")
  return 1217
end

success, result = pcall(myFunction)
if success then
    print("Function executed successfully:", result)
else
    print("Error occurred:", result)
end